////package com.shycloud.mido.gateway.config;
//////
//////import org.springframework.context.annotation.Bean;
//////import org.springframework.context.annotation.Configuration;
//////import org.springframework.web.cors.CorsConfiguration;
//////import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
//////import org.springframework.web.filter.CorsFilter;
//////
///////**
////// * @author Xiaoxing Yu on 2020/07/19
////// */
//////@Configuration
//////public class CorsConfig {
//////
//////	/**
//////	 * 跨域过滤器
//////	 *
//////	 * @return
//////	 */
//////	private CorsConfiguration buildConfig() {
//////		CorsConfiguration corsConfiguration = new CorsConfiguration();
//////		corsConfiguration.addAllowedOrigin("*");
//////		corsConfiguration.addAllowedHeader("*");
//////		corsConfiguration.addAllowedMethod("*");
//////		return corsConfiguration;
//////	}
//////
//////
//////	/**
//////	 * 跨域过滤器
//////	 *
//////	 * @return
//////	 */
//////	@Bean
//////	public CorsFilter corsFilter() {
//////		UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
//////		source.registerCorsConfiguration("/**", buildConfig());
//////		return new CorsFilter(source);
//////	}
//////}
////
////import org.springframework.boot.web.servlet.FilterRegistrationBean;
////import org.springframework.context.annotation.Bean;
////import org.springframework.context.annotation.Configuration;
////import org.springframework.web.cors.CorsConfiguration;
////import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
////import org.springframework.web.filter.CorsFilter;
////
////@Configuration
////public class CorsConfig {
////
////	@Bean
////	public FilterRegistrationBean corsFilter(){
////			CorsConfiguration config=new CorsConfiguration();
////			config.setAllowCredentials(true);
////			config.addAllowedOrigin("*");
////			config.addAllowedHeader("*");
////			config.addAllowedMethod("*");
////			config.setMaxAge(3600L);
////			config.addExposedHeader("Content-Type");
////			config.addExposedHeader("X-Requested-With");
////			config.addExposedHeader("accept");
////			config.addExposedHeader("Origin");
////			config.addExposedHeader("Access-Control-Request-Method");
////			config.addExposedHeader("Access-Control-Request-Headers");
////			UrlBasedCorsConfigurationSource configSource= new UrlBasedCorsConfigurationSource();
////			configSource.registerCorsConfiguration("/**", config);
////			org.springframework.boot.web.servlet.FilterRegistrationBean bean =new FilterRegistrationBean<>(new CorsFilter(configSource));
////			//设置过滤器的优先级
////			bean.setOrder(0);
////		return bean;
////	}
////
////}
//
//package com.shycloud.mido.gateway.config;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.cors.CorsConfiguration;
//import org.springframework.web.cors.reactive.CorsWebFilter;
//import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
//import org.springframework.web.util.pattern.PathPatternParser;
//
///**
// * description:
// *
// * @author wangpeng
// * @date 2019/01/02
// */
//@Configuration
//public class CorsConfig {
//	@Bean
//	public CorsWebFilter corsFilter() {
//		CorsConfiguration config = new CorsConfiguration();
//		config.addAllowedMethod("*");
//		config.addAllowedOrigin("*");
//		config.addAllowedHeader("*");
//
//		UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(new PathPatternParser());
//		source.registerCorsConfiguration("/**", config);
//
//		return new CorsWebFilter(source);
//	}
//}
